#/usr/bin/sh
PROJECT=$1
JAVA=~/jdk/jdk-17.0.11/bin/java
rm -rf ${OPENGROK_INSTANCE_BASE}/data/${PROJECT}
rm -rf ${OPENGROK_INSTANCE_BASE}/history/${PROJECT}
rm -rf ${OPENGROK_INSTANCE_BASE}/etc/${PROJECT}
mkdir -p ${OPENGROK_INSTANCE_BASE}/data/${PROJECT}
mkdir -p ${OPENGROK_INSTANCE_BASE}/history/${PROJECT}
mkdir -p ${OPENGROK_INSTANCE_BASE}/etc/${PROJECT}
${JAVA} -jar ${OPENGROK_INSTANCE_BASE}/lib/opengrok.jar \
    -P -S -v \
    -s ${OPENGROK_INSTANCE_BASE}/src/${PROJECT} -d ${OPENGROK_INSTANCE_BASE}/data/${PROJECT} \
    -H --repository  ${OPENGROK_INSTANCE_BASE}/history/${PROJECT} \
    -W ${OPENGROK_INSTANCE_BASE}/etc/${PROJECT}/configuration.xml \
    -i d:out -i d:cts -i d:developers -i d:development -i d:platform_testing -i d:prebuilts -i d:sdk -i d:test \
    -i d:toolchain -i d:out_krn  -i d:out_hal
